/**
 * @desc 判断目标时间是否处于上半年
 * @param date
 * @returns
 */
export const isPrevYear = (date: string | number | Date) => {
  const target = new Date(date);
  const year = target.getFullYear();
  const comparedDate = new Date(year + '-07-01');
  return target.getTime() < comparedDate.getTime();
};

export const isEmptyAllFields = (value: any) => {
  let flag = true;
  for (const key in value) {
    if (!!value?.[key]) {
      flag = false;
      break;
    }
  }
  return flag;
};

export const isNotData = (value: any): value is null | undefined | '' => {
  return [null, undefined, ''].includes(value);
};
